﻿(function () {

    layui.use(["layer", "jquery", "form", "laydate", "tree"], function () {
        var layer = layui.layer;
        var $ = layui.jquery;
        var form = layui.form;
        var laydate = layui.laydate;
        var tree = layui.tree;

        $(document).ready(function () {
            $(".fold-btn").click(onFoldBtnClick);
        });

        function onFoldBtnClick() {
            var el = $(this);
            var el2 = el.find("i").eq(0);
            var table = el.parent().parent().parent();
            var trs = table.find("tr:gt(0)");
            if (trs.eq(0).css("display") == "none") {
                trs.show();
                el2.removeClass("layui-icon-folder");
                el2.addClass("layui-icon-folder-open");
            } else {
                trs.hide();
                el2.removeClass("layui-icon-folder-open");
                el2.addClass("layui-icon-folder");
            }
        }
    });

})();